package com.ruoyi.security.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import cn.hutool.core.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.security.mapper.AfRiskIdentificationMapper;
import com.ruoyi.security.domain.AfRiskIdentification;
import com.ruoyi.security.service.IAfRiskIdentificationService;

/**
 * 风险识别Service业务层处理
 *
 * @author cjie
 * @date 2021-07-24
 */
@Service
public class AfRiskIdentificationServiceImpl implements IAfRiskIdentificationService {
    @Autowired
    private AfRiskIdentificationMapper afRiskIdentificationMapper;

    /**
     * 查询风险识别
     *
     * @param id 风险识别ID
     * @return 风险识别
     */
    @Override
    public AfRiskIdentification selectAfRiskIdentificationById(String id) {
        return afRiskIdentificationMapper.selectAfRiskIdentificationById(id);
    }

    /**
     * 查询风险识别列表
     *
     * @param afRiskIdentification 风险识别
     * @return 风险识别
     */
    @Override
    public List<AfRiskIdentification> selectAfRiskIdentificationList(AfRiskIdentification afRiskIdentification) {
        return afRiskIdentificationMapper.selectAfRiskIdentificationList(afRiskIdentification);
    }

    /**
     * 新增风险识别
     *
     * @param afRiskIdentification 风险识别
     * @return 结果
     */
    @Override
    public int insertAfRiskIdentification(AfRiskIdentification afRiskIdentification) {
        afRiskIdentification.setId(IdUtil.getSnowflake(0, 0).nextIdStr());
        afRiskIdentification.setCreateTime(DateUtils.getNowDate());
        afRiskIdentification.setCreateBy(SecurityUtils.getUsername());
        return afRiskIdentificationMapper.insertAfRiskIdentification(afRiskIdentification);
    }

    /**
     * 修改风险识别
     *
     * @param afRiskIdentification 风险识别
     * @return 结果
     */
    @Override
    public int updateAfRiskIdentification(AfRiskIdentification afRiskIdentification) {
        afRiskIdentification.setUpdateTime(DateUtils.getNowDate());
        afRiskIdentification.setUpdateBy(SecurityUtils.getUsername());
        return afRiskIdentificationMapper.updateAfRiskIdentification(afRiskIdentification);
    }

    /**
     * 批量删除风险识别
     *
     * @param ids 需要删除的风险识别ID
     * @return 结果
     */
    @Override
    public int deleteAfRiskIdentificationByIds(String[] ids) {
        return afRiskIdentificationMapper.deleteAfRiskIdentificationByIds(ids);
    }

    /**
     * 删除风险识别信息
     *
     * @param id 风险识别ID
     * @return 结果
     */
    @Override
    public int deleteAfRiskIdentificationById(String id) {
        return afRiskIdentificationMapper.deleteAfRiskIdentificationById(id);
    }
}
